package com.guit.hrms.mapper;

import com.guit.hrms.po.statistics.CountRecruitment;
import com.guit.hrms.po.statistics.StatisticalInterviewPassRate;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StatisticsMapper {


    /**
     * 计划类型为部门的情况查询招聘计划
     * @param planId
     * @param planType
     * @return
     */
    List<CountRecruitment> countRecruitment(Integer planId,Integer planType);

    /**
     * 部门招聘信息查询
     * @param planId
     */
    @Select("select " +
            "rp.plan_id,plan_name,plan_type ," +
            "sum(pdj.person) allRecruitsNumber ," +
            "sum(pdj.applicant_number) allApplicantNumber ," +
            "sum(pdj.through_number) allThroughNumber" +
            " from recruitment_plan rp,plan_dept_job pdj where rp.plan_id = pdj.plan_id and rp.plan_id = #{planId}")
    CountRecruitment getRecruitmentToDept(Integer planId);

    /**
     * 学院招聘信息查询
     * @param planId
     * @return
     */
    @Select("select " +
            "rp.plan_id,plan_name,plan_type ," +
            "sum(paj.person) allRecruitsNumber ," +
            "sum(paj.applicant_number) allApplicantNumber ," +
            "sum(paj.through_number) allThroughNumber" +
            " from recruitment_plan rp,guit.plan_academy_job paj where rp.plan_id = paj.plan_id and rp.plan_id = #{planId}")
    CountRecruitment getRecruitmentToAcademy(Integer planId);


    /**
     *
     * @param planId
     * @param planType
     * @return
     */
    List<StatisticalInterviewPassRate> statisticalInterviewPassRate(Integer planId, Integer planType);

    /**
     * interviewId不为空的情况下查询通过率（部门）
     * @param planId
     * @param interviewId
     * @param deptId
     * @param positionNumber
     * @return
     */
    List<StatisticalInterviewPassRate> interviewIdNotNullToDept(Integer planId, Integer planType, Integer interviewId, String deptId, String positionNumber);

    /**
     * 统计通过率
     * @param planId
     * @param planType
     * @param deptId
     * @param positionNumber
     * @return
     */
    List<StatisticalInterviewPassRate> statisticalInterviewPassRateToDept(Integer planId, Integer planType,Integer interviewId, String deptId, String positionNumber);
}
